
from interactive import *

#1) Create a new breeding Pair 
css("#ColonyView")
linkpart("EPO").click()
twait()

css("#ColonyMenu")
linkpart("Mice").click()
twait()

Select(css("#MouseList select")).select_by_value("1")
twait()

Edit()
css("#MouseDetail #breedingButton").click()
twait()

New()
twait()
css("#BreedingPairDetail #Comment").clear()
css("#BreedingPairDetail #Comment").send_keys("A New Breeding Pair Comment")
twait()

Done()
twait()
Edit()
twait()
linkpart("BreedingPair1").click()
twait()
assert(css("#BreedingPairDetail #FemaleID").get_attribute("value") == "1")
assert(css("#BreedingPairDetail #Comment").get_attribute("value") == "A New Breeding Pair Comment")
#2) Add a second mouse to the breeding pair
css("#BreedingPairDetail #MaleIDButton").click()
twait()

Select(css("#MouseList select")).select_by_value("6")
twait()

Edit()
css("#MouseDetail #breedingButton").click()
twait()
linkpart("BreedingPair1").click()
twait()
Done()

Edit()
twait()
linkpart("BreedingPair1").click()
twait()
assert(css("#BreedingPairDetail #MaleID").get_attribute("value") == "6")
assert(css("#BreedingPairDetail #FemaleID").get_attribute("value") == "1")
assert(css("#BreedingPairDetail #Comment").get_attribute("value") == "A New Breeding Pair Comment")
twait()

#3) Create a new Breeding Pair by adding a new mouse to an 
#   existing breeding pair
Back()
twait()
Back()
twait()

css("#ColonyMenu")
linkpart("Mice").click()
twait()

Select(css("#MouseList select")).select_by_value("11")
twait()

Edit()
css("#MouseDetail #breedingButton").click()
twait()

twait()
linkpart("BreedingPair1").click()
twait()
Done()

twait()
Edit()
twait()
linkpart("BreedingPair1").click()
twait()
assert(css("#BreedingPairDetail #MaleID").get_attribute("value") == "6")
assert(css("#BreedingPairDetail #FemaleID").get_attribute("value") == "1")
assert(css("#BreedingPairDetail #Comment").get_attribute("value") == "A New Breeding Pair Comment")
twait()

Back()
twait()
Edit()
twait()
linkpart("BreedingPair2").click()
twait()
assert(css("#BreedingPairDetail #MaleID").get_attribute("value") == "11")
assert(css("#BreedingPairDetail #FemaleID").get_attribute("value") == "1")
assert(css("#BreedingPairDetail #Comment").get_attribute("value") == "A New Breeding Pair Comment")
twait()

driver.quit()
